home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / systems / vm-cms / texshell / warning.xedit < prev    next >
Text File  |  1993-09-27  |  5KB  |  143 lines

  1. /********************************************************************/
  2. /* Package  : TeXShell for CMS, version 2.0                         */
  3. /* Author   : Humberto Jose' Bortolossi                             */
  4. /*                                                                  */
  5. /* Bitnet   : hjbortol at brlncc.bitnet, hjbortol at brfuem.bitnet  */
  6. /* Internet : hjbortol at gauss.impa.br                             */
  7. /*                                                                  */
  8. /* Organizations : Instituto de Matematica Pura e Aplicada (IMPA)   */
  9. /*                 Fundacao Universidade Estadual de Maringa'       */
  10. /*                                                                  */
  11. /* Copyright : This program is freely distributable.                */
  12. /*             You can do changes but, please, keep my name.        */
  13. /*                                                                  */
  14. /* Description : This macro will do two things: first, it will look */
  15. /*               up  TEXLOG  file  searching for  'errors/warnings' */
  16. /*               messages. The respective lines will recorded  into */
  17. /*               <fn> ERROR (for errors) and <fn> WARNING (for war- */
  18. /*               nings). Second, if you press <PF4> at LOGVIEW  en- */
  19. /*               vironment, WARNING XEDIT will put the current line */
  20. /*               of <fn> TEX as the line where the error was found. */
  21. /*               This macro  uses two temp files: TEXSHELL CONTROL1 */
  22. /*               and TEXSHELL CONTROL2. All temp files are   erased */
  23. /*               when you go out LOGVIEW environment.               */
  24. /*                                                                  */
  25. /*                                               (C) Copyright 1992 */
  26. /********************************************************************/
  27.  parse arg fn .
  28.  
  29.  set emsg off
  30. 'listfile' fn 'WARNING * (NOHEADER ALLOC STACK'
  31.  if rc /= 0 then do
  32.      call process(fn)
  33.     'execio 1 diskr TEXSHELL CONTROL2' FileMode '(FINIS'
  34.      parse pull CurrentError
  35.      DropBuf
  36.  end
  37. 'listfile' fn 'WARNING * (NOHEADER ALLOC STACK'
  38.  pull . . FileMode . . NumberOfErrors .
  39.  DropBuf
  40. 'execio 1 diskr TEXSHELL CONTROL2' FileMode '(FINIS'
  41.  parse pull CurrentError
  42.  
  43.  DropBuf
  44.  
  45.  if CurrentError >= NumberOfErrors then CurrentError = 0
  46.  CurrentError = CurrentError + 1
  47.  set emsg off; 'erase TEXSHELL CONTROL2' FileMode; set emsg on
  48. 'execio 1 diskw TEXSHELL CONTROL2' FileMode '(FINIS STRING' CurrentError
  49. 'execio' NumberOfErrors 'diskr' fn 'WARNING' FileMode '(FINIS'
  50.  do i = 1 to CurrentError - 1
  51.       pull .
  52.  end
  53.  pull LogLine SourceLine
  54.  DropBuf
  55.  queue 'sos tabcmdf'
  56.  queue 'top'
  57.  queue SourceLine
  58.  queue 'sos tabcmdf'
  59.  queue 'top'
  60.  queue LogLine
  61. exit 0
  62.  
  63.  
  64. process:
  65.  parse arg fn
  66.  set emsg off
  67. 'listfile' fn 'TEXLOG * (NOHEADER ALLOC STACK'
  68.  if rc /= 0 then do
  69.      say 'File' fn 'TEXLOG * not found.'
  70.      DropBuf
  71.      exit 0
  72.  end
  73.  else do
  74.      pull . . FileMode . . NumberOfLines .
  75.  end
  76.  
  77.  DropBuf
  78.  
  79. 'listfile' fn 'ERROR * (NOHEADER ALLOC STACK'
  80.  if rc /= 0 then do
  81.      DropBuf
  82.  end
  83.  else do
  84.     'erase' fn 'ERROR  *'
  85.  end
  86.  DropBuf
  87.  
  88. 'listfile' fn 'WARNING * (NOHEADER ALLOC STACK'
  89.  if rc /= 0 then do
  90.      DropBuf
  91.  end
  92.  else do
  93.     'erase' fn 'WARNING *'
  94.  end
  95.  DropBuf
  96.  set emsg on
  97.  
  98. 'execio' NumberOfLines 'diskr' fn 'TEXLOG' FileMode '(FINIS'
  99.  
  100.  do while queued() /= 0
  101.     parse pull Line
  102.     if subword(Line,1,2) = 'LaTeX Warning:' then do
  103.       LogLine = NumberOfLines - queued()
  104.       parse pull Line
  105.       do forever while substr(Line,1,2) /= 'l.'
  106.           parse pull Line
  107.       end
  108.       WarningLine = delstr(subword(Line,1,1),1,2)
  109.       OutRecord = right(LogLine,5) right(WarningLine,5)
  110.      'execio 1 diskw' fn 'WARNING' FileMode '(FINIS STRING' OutRecord
  111.     end
  112.  
  113.     if subword(Line,1,1) = '!' then do
  114.       LogLine = NumberOfLines - queued()
  115.       parse pull Line
  116.       do forever while substr(Line,1,2) /= 'l.'
  117.           parse pull Line
  118.       end
  119.       ErrorLine = delstr(subword(Line,1,1),1,2)
  120.       OutRecord = right(LogLine,5) right(ErrorLine,5)
  121.      'execio 1 diskw' fn 'ERROR' FileMode '(FINIS STRING' OutRecord
  122.     end
  123.  end
  124.  
  125.  
  126.  DropBuf
  127.  set emsg off
  128. 'erase TEXSHELL CONTROL1 *'
  129. 'erase TEXSHELL CONTROL2 *'
  130.  Junk = 0
  131. 'execio 1 diskw TEXSHELL CONTROL1' FileMode '(FINIS STRING' Junk
  132. 'execio 1 diskw TEXSHELL CONTROL2' FileMode '(FINIS STRING' Junk
  133.  
  134. 'listfile' fn 'WARNING' FileMode '(NOHEADER ALLOC STACK'
  135.  if rc /= 0 then do
  136.      DropBuf
  137.      say 'No warnings ...'
  138.      exit 0
  139.  end
  140.  DropBuf
  141.  
  142. return
  143.